package net.yihang.miaosha.service;

import net.yihang.miaosha.dao.GoodsDao;
import net.yihang.miaosha.domain.Goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsService {

    @Autowired
    private GoodsDao goodsDao;

    public List<Goods> findAll() {
        return goodsDao.findAll();
    }

    public Goods findById(long id) {
        return goodsDao.findById(id);
    }

    public boolean updateStock(long id){
        int rows = goodsDao.updateStock(id);
        return rows >= 1;
    }
}
